var rabbitImg = "./frame_animation_1.png"
// var positionArr = ["1082 0","926 0","770 0","614 0","458 0","302 0","146 0","-10 0"]
var positionArr = ["-1135 0","-961 0","-777 0","-599 0","-425 0","-180 0","0 0"]

var ele = document.getElementById("rabbit")
animation(ele,positionArr,rabbitImg)
function animation(ele,positionArr,imgUrl){
  ele.style.backgroundImage = "url("+imgUrl+")"
  ele.style.backgroundRepeat = "no-repeat"
  positionArr = positionArr.reverse()
  var index = 0
  function run(){
    var position = positionArr[index].split(" ")
    console.log(position);
    ele.style.backgroundPosition = position[0]+"px " + position[1]+"px"
    index++
    if(index>=positionArr.length){
      index = 0
    }
    setTimeout(run, 80);
  }

  run()
}